home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / ENET.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  4.1 KB  |  148 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ENET.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __ENET__
  18. #define __ENET__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __OSUTILS__
  27. #include <OSUtils.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <Memory.h>                                            */
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. #if GENERATINGPOWERPC
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. #ifdef __CFM68K__
  41. #pragma lib_export on
  42. #endif
  43.  
  44.  
  45. enum {
  46.     ENetSetGeneral                = 253,                            /*Set "general" mode*/
  47.     ENetGetInfo                    = 252,                            /*Get info*/
  48.     ENetRdCancel                = 251,                            /*Cancel read*/
  49.     ENetRead                    = 250,                            /*Read*/
  50.     ENetWrite                    = 249,                            /*Write*/
  51.     ENetDetachPH                = 248,                            /*Detach protocol handler*/
  52.     ENetAttachPH                = 247,                            /*Attach protocol handler*/
  53.     ENetAddMulti                = 246,                            /*Add a multicast address*/
  54.     ENetDelMulti                = 245,                            /*Delete a multicast address*/
  55.     EAddrRType                    = 'eadr'
  56. };
  57.  
  58. typedef struct EParamBlock EParamBlock, *EParamBlkPtr;
  59.  
  60. /*
  61.         ENETCompletionProcPtr uses register based parameters on the 68k and cannot
  62.         be written in or called from a high-level language without the help of
  63.         mixed mode or assembly glue.
  64.  
  65.         In:
  66.          => thePBPtr        A0.L
  67. */
  68.  
  69. #if GENERATINGCFM
  70. typedef UniversalProcPtr ENETCompletionUPP;
  71. #else
  72. typedef Register68kProcPtr ENETCompletionUPP;
  73. #endif
  74.  
  75. struct EParamMisc1 {
  76.     short                            eProtType;                    /*Ethernet protocol type*/
  77.     Ptr                                ePointer;                    /*No support for PowerPC code*/
  78.     short                            eBuffSize;                    /*buffer size*/
  79.     short                            eDataSize;                    /*number of bytes read*/
  80. };
  81. typedef struct EParamMisc1 EParamMisc1, *EParamMisc1Ptr;
  82.  
  83. struct EParamMisc2 {
  84.     char                            eMultiAddr[6];                /*Multicast Address*/
  85. };
  86. typedef struct EParamMisc2 EParamMisc2, *EParamMisc2Ptr;
  87.  
  88. struct EParamBlock {
  89.     QElem                            *qLink;                        /*General EParams*/
  90.     short                            qType;                        /*queue type*/
  91.     short                            ioTrap;                        /*routine trap*/
  92.     Ptr                                ioCmdAddr;                    /*routine address*/
  93.     ENETCompletionUPP                ioCompletion;                /*completion routine*/
  94.     OSErr                            ioResult;                    /*result code*/
  95.     StringPtr                        ioNamePtr;                    /*->filename*/
  96.     short                            ioVRefNum;                    /*volume reference or drive number*/
  97.     short                            ioRefNum;                    /*driver reference number*/
  98.     short                            csCode;                        /*Call command code*/
  99.     union {
  100.         EParamMisc1                        EParms1;
  101.         EParamMisc2                        EParms2;
  102.     } u;
  103. };
  104.  
  105. enum {
  106.     uppENETCompletionProcInfo = kRegisterBased
  107.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(EParamBlkPtr)))
  108. };
  109.  
  110. #if GENERATINGCFM
  111. #define CallENETCompletionProc(userRoutine, thePBPtr)        \
  112.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppENETCompletionProcInfo, (thePBPtr))
  113. #else
  114. /* (*ENETCompletionProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  115. #endif
  116.  
  117. #if GENERATINGCFM
  118. #define NewENETCompletionProc(userRoutine)        \
  119.         (ENETCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppENETCompletionProcInfo, GetCurrentArchitecture())
  120. #else
  121. #define NewENETCompletionProc(userRoutine)        \
  122.         ((ENETCompletionUPP) (userRoutine))
  123. #endif
  124.  
  125. extern pascal OSErr EWrite(EParamBlkPtr thePBptr, Boolean async);
  126. extern pascal OSErr EAttachPH(EParamBlkPtr thePBptr, Boolean async);
  127. extern pascal OSErr EDetachPH(EParamBlkPtr thePBptr, Boolean async);
  128. extern pascal OSErr ERead(EParamBlkPtr thePBptr, Boolean async);
  129. extern pascal OSErr ERdCancel(EParamBlkPtr thePBptr, Boolean async);
  130. extern pascal OSErr EGetInfo(EParamBlkPtr thePBptr, Boolean async);
  131. extern pascal OSErr ESetGeneral(EParamBlkPtr thePBptr, Boolean async);
  132. extern pascal OSErr EAddMulti(EParamBlkPtr thePBptr, Boolean async);
  133. extern pascal OSErr EDelMulti(EParamBlkPtr thePBptr, Boolean async);
  134.  
  135. #ifdef __CFM68K__
  136. #pragma lib_export off
  137. #endif
  138.  
  139. #if GENERATINGPOWERPC
  140. #pragma options align=reset
  141. #endif
  142.  
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146.  
  147. #endif /* __ENET__ */
  148.